package com.vdf.sisconsolid.persistencemodule.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * The persistent class for the address database table.
 * 
 */
@Entity
@Table(name = "address")
public class Address implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(nullable = false)
	private Long id;

	@Column(length = 5)
	private String block;

	@Column(length = 5)
	private String department;

	@Column(length = 5)
	private String floor;

	@Column(length = 5)
	private String lot;

	private Integer number;

	// bi-directional many-to-one association to City
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_city")
	private City city;

	// bi-directional many-to-one association to Neighborhood
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_neighborhood")
	private Neighborhood neighborhood;

	// bi-directional many-to-one association to Province
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_province")
	private Province province;

	// bi-directional many-to-one association to Street
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_street")
	private Street street;

	// bi-directional many-to-one association to Cell
	@OneToMany(mappedBy = "address")
	private List<Cell> cells;

	public Address() {
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getBlock() {
		return this.block;
	}

	public void setBlock(String block) {
		this.block = block;
	}

	public String getDepartment() {
		return this.department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public String getFloor() {
		return this.floor;
	}

	public void setFloor(String floor) {
		this.floor = floor;
	}

	public String getLot() {
		return this.lot;
	}

	public void setLot(String lot) {
		this.lot = lot;
	}

	public Integer getNumber() {
		return this.number;
	}

	public void setNumber(Integer number) {
		this.number = number;
	}

	public City getCity() {
		return this.city;
	}

	public void setCity(City city) {
		this.city = city;
	}
	
	public void setIdCity(Long id) {
		this.city = new City();
		this.city.setId(id);
	}

	public Neighborhood getNeighborhood() {
		return this.neighborhood;
	}

	public void setNeighborhood(Neighborhood neighborhood) {
		this.neighborhood = neighborhood;
	}
	
	public void setIdNeighborhood(Long id) {
		if (id == null)
			return;
		this.neighborhood = new Neighborhood();
		this.neighborhood.setId(id);
	}

	public Province getProvince() {
		return this.province;
	}

	public void setProvince(Province province) {
		this.province = province;
	}
	
	public void setIdProvince(Long id) {
		this.province = new Province();
		this.province.setId(id);
	}

	public Street getStreet() {
		return this.street;
	}

	public void setStreet(Street street) {
		this.street = street;
	}
	
	public void setIdStreet(Long id) {
		if (id == null)
			return;
		this.street = new Street();
		this.street.setId(id);
	}

	public List<Cell> getCells() {
		return this.cells;
	}

	public void setCells(List<Cell> cells) {
		this.cells = cells;
	}

}